<html><head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"><title>Sort_(Numeric).pb</title></head>
<body bgcolor="#EFF1F0" link="#3A3966" vlink="#000000" alink="#000000">
<pre><font face="Courier New, Courier, mono"size="2"><font color="#3A3966">;
</font><font color="#3A3966">; ------------------------------------------------------------
</font><font color="#3A3966">;
</font><font color="#3A3966">;   PureBasic - Sort (Numerical) example file
</font><font color="#3A3966">;
</font><font color="#3A3966">;    (c) Fantaisie Software
</font><font color="#3A3966">;
</font><font color="#3A3966">; ------------------------------------------------------------
</font><font color="#3A3966">;
</font>
<font color="#3A3966">; Change the number of elements here, to see the speed of the sort routine :)
</font><font color="#3A3966">;
</font><font color="#924B72">#NbElements</font> = 20

<b><font color="#3A3966">Dim</font></b> <b><font color="#3A3966">Array</font></b>.b(<font color="#924B72">#NbElements</font>)

<b><font color="#3A3966">For</font></b> k=0 <b><font color="#3A3966">To</font></b> <font color="#924B72">#NbElements</font>
  <b><font color="#3A3966">Array</font></b>(k) =<font color="#3A3966"> Random</font>(10000)
<b><font color="#3A3966">Next</font></b>

<font color="#3A3966">; Fill the array with lot of random number
</font><font color="#3A3966">;
</font>
<b><font color="#3A3966">For</font></b> k=0 <b><font color="#3A3966">To</font></b> <font color="#924B72">#NbElements</font>
  <b><font color="#3A3966">Debug</font></b> <b><font color="#3A3966">Array</font></b>(k)
<b><font color="#3A3966">Next</font></b>

<font color="#3A3966">; Sort the whole array !
</font><font color="#3A3966">;
</font><font color="#3A3966">SortArray</font>(<b><font color="#3A3966">Array</font></b>(), <font color="#924B72">#PB_Sort_Ascending</font>)

<b><font color="#3A3966">Debug</font></b> "----------------"

<b><font color="#3A3966">For</font></b> k=0 <b><font color="#3A3966">To</font></b> <font color="#924B72">#NbElements</font>
  <b><font color="#3A3966">Debug</font></b> <b><font color="#3A3966">Array</font></b>(k)
<b><font color="#3A3966">Next</font></b>

<font color="#3A3966">MessageRequester</font>("Sort Example", "Sort finished.")

</font></pre>
</body></html>
